{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}
{% import "_my_wtf_macros.html" as my_wtf_macros %}

{% block title %}万屏时代OPC--app推广根节点统计{% endblock %}

{% block panel_heading %}
    万屏时代OPC--app推广根节点统计
{% endblock %}

{% block panel_body %}
    <form id="search-demand-form" action="{{ url_for('op_bp.app_promotion_cens') }}" method="post" class="form"
          role="form">
        {{ my_wtf_macros.form_field(form.app_root_invite_user_id, div_col=4, label_col=4, field_col=7) }}
        {{ my_wtf_macros.form_field(form.mobile, div_col=4, label_col=4, field_col=7) }}
        <div class="btn-group">
            <button type="submit" class="btn btn-info"
                    id="query-demand-btn">
                查询
            </button>
        </div>
    </form>

    {% if pagination %}
        <div class="pagination">
            {{ macros.pagination_widget(pagination, 'op_bp.app_promotion_cens', **url_kwargs) }}
        </div>
    {% endif %}
    <table id="user-info-table" class="table table-bordered table-hover table-condensed table-striped">
        <thead>
        <tr>
            <th>ID</th>
            <th>根节点</th>
            <th>邀请人数</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for each in stats %}
            <tr>
                <td>{{ each.id }}</td>
                <td>{{ each.root_mobile | encrypt}}&nbsp;{{ each.root_name }}</td>
                <td>{{ each.invite_cnt }}</td>
                <td>
                    <a
                            class="btn btn-xs btn-primary"
                            href="{{ url_for('op_bp.user_info', user_id=each.id) }}"
                            name="user-info"
                            target="_blank"
                    >编辑</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% if pagination %}
        <div class="pagination">
            {{ macros.pagination_widget(pagination, 'op_bp.app_promotion_cens', **url_kwargs) }}
        </div>
    {% endif %}
{% endblock %}
